// Just a mock data 模拟权限菜单接口
// 菜单管理数据
const menu = [{
  'id': 1,
  'name': '工作台',
  'enname': 'dashboard',
  'type': 1,
  'type_label': '普通菜单',
  'route_icon': 'awesome-icon fas fa-tachometer-alt',
  'route_name': 'Dashboard',
  'route_path': '/dashboard',
  'route_component': '/dashboard/index',
  'permission': 'admin.dashboard',
  'sort': 999,
  'created_at': '2021-08-03 12:37:45',
  'updated_at': '2021-08-03 12:37:45',
  children: [{
    'id': 2,
    'name': '电脑访问量',
    'enname': 'pc web traffic',
    'type': 2,
    'type_label': '按钮',
    'route_icon': '',
    'route_name': '',
    'route_path': '',
    'route_component': '',
    'permission': 'admin.traffic.pc',
    'sort': 999,
    'created_at': '2021-08-03 12:37:45',
    'updated_at': '2021-08-03 12:37:45'
  }]
},
{
  'id': 3,
  'name': '营销管理',
  'enname': 'marketing management',
  'type': 1,
  'type_label': '普通菜单',
  'route_icon': 'component',
  'route_name': 'Marketing',
  'route_path': '/marketing',
  'route_component': '/layout',
  'permission': 'admin.marketing',
  'sort': 999,
  'created_at': '2021-08-03 12:37:45',
  'updated_at': '2021-08-03 12:37:45',
  children: [{
    'id': 4,
    'name': '友情链接',
    'enname': 'links',
    'type': 1,
    'type_label': '普通菜单',
    'route_icon': '',
    'route_name': 'Links',
    'route_path': '/links',
    'route_component': '/empty',
    'permission': 'admin.links',
    'sort': 999,
    'created_at': '2021-08-03 12:37:45',
    'updated_at': '2021-08-03 12:37:45',
    children: [{
      'id': 5,
      'name': '列表',
      'enname': 'links list',
      'type': 1,
      'type_label': '普通菜单',
      'route_icon': 'awesome-icon fas fa-link',
      'route_name': 'LinksIndex',
      'route_path': '/links/index',
      'route_component': '/links/index',
      'permission': 'admin.links.index',
      'sort': 999,
      'created_at': '2021-08-03 12:37:45',
      'updated_at': '2021-08-03 12:37:45'
    },
    {
      'id': 12,
      'name': '详情',
      'enname': 'links show',
      'type': 2,
      'type_label': '按钮',
      'route_icon': '',
      'route_name': '',
      'route_path': '',
      'route_component': '',
      'permission': 'admin.links.show',
      'sort': 999,
      'created_at': '2021-08-03 12:37:45',
      'updated_at': '2021-08-03 12:37:45'
    },
    {
      'id': 6,
      'name': '添加',
      'enname': 'links create',
      'type': 2,
      'type_label': '按钮',
      'route_icon': '',
      'route_name': 'LinksCreate',
      'route_path': '/links/create',
      'route_component': '/links/edit',
      'permission': 'admin.links.store',
      'sort': 999,
      'created_at': '2021-08-03 12:37:45',
      'updated_at': '2021-08-03 12:37:45'
    },
    {
      'id': 7,
      'name': '编辑',
      'enname': 'links edit',
      'type': 2,
      'type_label': '按钮',
      'route_icon': '',
      'route_name': 'LinksEdit',
      'route_path': '/links/:id(\\d+)/edit',
      'route_component': '/links/edit',
      'permission': 'admin.links.update',
      'sort': 999,
      'created_at': '2021-08-03 12:37:45',
      'updated_at': '2021-08-03 12:37:45'
    },
    {
      'id': 8,
      'name': '删除',
      'enname': 'links delete',
      'type': 2,
      'type_label': '按钮',
      'route_icon': '',
      'route_name': '',
      'route_path': '',
      'route_component': '',
      'permission': 'admin.links.destory',
      'sort': 999,
      'created_at': '2021-08-03 12:37:45',
      'updated_at': '2021-08-03 12:37:45'
    },
    {
      'id': 9,
      'name': '排序',
      'enname': 'links sort',
      'type': 2,
      'type_label': '按钮',
      'route_icon': '',
      'route_name': '',
      'route_path': '',
      'route_component': '',
      'permission': 'admin.links.sort',
      'sort': 999,
      'created_at': '2021-08-03 12:37:45',
      'updated_at': '2021-08-03 12:37:45'
    },
    {
      'id': 10,
      'name': '发布状态',
      'enname': 'links publish',
      'type': 2,
      'type_label': '按钮',
      'route_icon': '',
      'route_name': '',
      'route_path': '',
      'route_component': '',
      'permission': 'admin.links.publish',
      'sort': 999,
      'created_at': '2021-08-03 12:37:45',
      'updated_at': '2021-08-03 12:37:45'
    }

    ]
  }]
},
{
  'id': 11,
  'name': '外部链接',
  'enname': 'external link',
  'type': 1,
  'type_label': '普通菜单',
  'route_icon': 'link',
  'route_name': 'ExternalLink',
  'route_path': '/external-link',
  'route_component': '/layout',
  'api': '',
  'permission': 'admin.externalLink',
  'sort': 999,
  'created_at': '2021-08-03 12:37:45',
  'updated_at': '2021-08-03 12:37:45'
}
]

// 登录用户（左侧展示的）权限菜单数据
const userMenu = [{
  path: '/',
  component: '/layout',
  redirect: '/dashboard',
  children: [{
    path: 'dashboard',
    name: 'Dashboard',
    component: '/dashboard/index',
    meta: {
      title: '工作台',
      icon: 'awesome-icon fas fa-tachometer-alt',
      affix: true,
      roles: ['editor', 'admin']
    }
  }]
},
{
  path: '/info',
  name: 'Info',
  redirect: 'noRedirect',
  meta: {
    title: '信息管理',
    icon: 'awesome-icon far fa-newspaper',
    roles: ['admin']
  },
  component: '/layout',
  alwaysShow: true,
  children: [{
    name: 'InfoPublish',
    path: '/info-publish',
    alwaysShow: true,
    component: '/empty',
    redirect: 'noRedirect',
    meta: {
      title: '信息发布',
      icon: 'awesome-icon far fa-edit',
      roles: ['admin'],
      breadcrumb: false,
      isTree: true
    },
    children: [{
      name: 'InfoCategory100InfoNews',
      path: '/info-category/100/info-news',
      component: '/empty',
      alwaysShow: false,
      redirect: '/info-category/100/info-news/index',
      meta: {
        title: '新闻栏目1',
        roles: ['admin']
      },
      children: [{
        name: 'InfoCategory100InfoNewsIndex',
        path: '/info-category/:cate_id(\\d+)/info-news/index',
        component: '/info-news/index',
        hidden: true,
        meta: {
          title: '列表',
          roles: ['admin'],
          activeMenu: '/info-category/100/info-news',
          realPath: '/info-category/100/info-news/index'
        }
      }, {
        name: 'InfoCategory100InfoNewsCreate',
        path: '/info-category/:cate_id(\\d+)/info-news/create',
        component: '/info-news/edit',
        hidden: true,
        meta: {
          title: '添加',
          roles: ['admin'],
          activeMenu: '/info-category/100/info-news',
          realPath: '/info-category/100/info-news/create'
        }
      }, {
        name: 'InfoCategory100InfoNews220Edit',
        path: '/info-category/:cate_id(\\d+)/info-news/:id(\\d+)/edit',
        component: '/info-news/edit',
        hidden: true,
        meta: {
          title: '编辑',
          roles: ['admin'],
          activeMenu: '/info-category/100/info-news',
          realPath: '/info-category/100/info-news/220/edit'
        }
      }]
    },
    {
      name: 'InfoCategory200InfoPage233Edit',
      path: '/info-category/:cate_id(\\d+)/info-page/:id(\\d+)/edit',
      component: '/info-page/edit',
      meta: {
        title: '单页栏目1',
        roles: ['admin'],
        realPath: '/info-category/200/info-page/233/edit'
      }
    }
    ]
  },
  {
    name: 'InfoCategory',
    path: '/info-category',
    component: '/empty',
    alwaysShow: false,
    redirect: '/info-category/index',
    meta: {
      title: '栏目分类',
      icon: 'tree',
      roles: ['admin']
    },
    children: [{
      name: 'InfoCategoryIndex',
      path: '/info-category/index',
      component: '/info-category/index',
      hidden: true,
      meta: {
        title: '列表',
        roles: ['admin'],
        activeMenu: '/info-category'
      }
    }, {
      name: 'InfoCategoryCreate',
      path: '/info-category/create',
      component: '/info-category/edit',
      hidden: true,
      meta: {
        title: '添加',
        roles: ['admin'],
        activeMenu: '/info-category'
      }
    },
    {
      name: 'InfoCategoryEdit',
      path: '/info-category/:id(\\d+)/edit',
      component: '/info-category/edit',
      hidden: true,
      meta: {
        title: '编辑',
        roles: ['admin'],
        activeMenu: '/info-category'
      }
    }
    ]
  },
  {
    name: 'InfoModel',
    path: '/info-model',
    component: '/empty',
    meta: {
      title: '信息模型',
      icon: 'awesome-icon fas fa-database',
      roles: ['admin'],
      breadcrumb: false
    },
    alwaysShow: false,
    redirect: '/info-model/index',
    children: [{
      name: 'InfoModelindex',
      path: '/info-model/index',
      component: '/info-model/index',
      hidden: true,
      meta: {
        title: '列表',
        icon: 'awesome-icon fas fa-database',
        roles: ['admin'],
        activeMenu: '/info-model'
      }
    }]
  }
  ]
},
{
  path: '/marketing',
  name: 'Marketing',
  component: '/layout',
  redirect: 'noRedirect',
  alwaysShow: true,
  meta: {
    title: '营销管理',
    icon: 'component',
    roles: ['admin']
  },
  children: [{
    name: 'AdsSpace',
    path: '/ads-space',
    alwaysShow: false,
    component: '/empty',
    redirect: '/ads-space/index',
    meta: {
      title: '广告位',
      icon: 'awesome-icon fab fa-buysellads',
      roles: ['admin']
    },
    children: [{
      name: 'AdsSpaceIndex',
      path: '/ads-space/index',
      component: '/ads-space/index',
      hidden: true,
      meta: {
        title: '列表',
        roles: ['admin'],
        activeMenu: '/ads-space'
      }
    },
    {
      name: 'AdsSpaceCreate',
      path: '/ads-space/create',
      component: '/ads-space/edit',
      hidden: true,
      meta: {
        title: '添加',
        roles: ['admin'],
        activeMenu: '/ads-space'
      }
    },
    {
      name: 'AdsSpaceEdit',
      path: '/ads-space/:id(\\d+)/edit',
      component: '/ads-space/edit',
      hidden: true,
      meta: {
        title: '编辑',
        roles: ['admin'],
        activeMenu: '/ads-space'
      }
    }
    ]
  },
  {
    name: 'Ads',
    path: '/ads',
    hidden: true,
    component: '/empty',
    redirect: 'noRedirect',
    meta: {
      title: '广告',
      roles: ['admin']
    },
    children: [{
      name: 'AdsIndex',
      path: '/ads-space/:space_id(\\d+)/ads/index',
      component: '/ads/index',
      hidden: true,
      meta: {
        title: '列表',
        roles: ['admin'],
        activeMenu: '/ads-space'
      }
    }, {
      name: 'AdsCreate',
      path: '/ads-space/:space_id(\\d+)/ads/create',
      component: '/ads/edit',
      hidden: true,
      meta: {
        title: '添加',
        roles: ['admin'],
        activeMenu: '/ads-space'
      }
    }, {
      name: 'AdsEdit',
      path: '/ads-space/:space_id(\\d+)/ads/:id(\\d+)/edit',
      component: '/ads/edit',
      hidden: true,
      meta: {
        title: '编辑',
        roles: ['admin'],
        activeMenu: '/ads-space'
      }
    }]
  }, {
    name: 'Links',
    path: '/links',
    component: '/empty',
    meta: {
      title: '友情链接',
      icon: 'awesome-icon fas fa-link',
      roles: ['admin']
    },
    alwaysShow: false,
    redirect: '/links/index',
    children: [{
      name: 'LinksIndex',
      path: '/links/index',
      component: '/links/index',
      hidden: true,
      meta: {
        title: '列表',
        roles: ['admin'],
        activeMenu: '/links'
      }
    }, {
      name: 'LinksCreate',
      path: '/links/create',
      component: '/links/edit',
      meta: {
        title: '添加',
        roles: ['admin'],
        activeMenu: '/links'
      },
      hidden: true
    }, {
      name: 'LinksEdit',
      path: '/links/:id(\\d+)/edit',
      component: '/links/edit',
      hidden: true,
      meta: {
        title: '编辑',
        roles: ['admin'],
        activeMenu: '/links'
      }
    }]
  }, {
    name: 'Guestbook',
    path: '/guestbook',
    component: '/empty',
    meta: {
      title: '留言咨询',
      icon: 'message',
      roles: ['admin']
    },
    alwaysShow: false,
    redirect: '/guestbook/index',
    children: [{
      name: 'GuestbookIndex',
      path: '/guestbook/index',
      component: '/guestbook/index',
      hidden: true,
      meta: {
        title: '列表',
        roles: ['admin'],
        activeMenu: '/guestbook'
      }
    }]
  }
  ]
},
{
  path: '/system',
  name: 'System',
  component: '/layout',
  redirect: 'noRedirect',
  alwaysShow: true,
  meta: {
    title: '系统管理',
    icon: 'awesome-icon fas fa-tools',
    roles: ['admin']
  },
  children: [{
    name: 'Config',
    path: '/config',
    component: '/config/edit',
    alwaysShow: false,
    meta: {
      title: '系统配置',
      icon: 'el-icon-set-up',
      roles: ['admin']
    }
  }, {
    path: '/user',
    name: 'User',
    component: '/empty',
    alwaysShow: false,
    redirect: '/user/index',
    meta: {
      title: '管理员',
      icon: 'awesome-icon fas fa-users-cog',
      roles: ['admin']
    },
    children: [{
      name: 'UserIndex',
      path: '/user/index',
      component: '/user/index',
      hidden: true,
      meta: {
        title: '列表',
        roles: ['admin'],
        activeMenu: '/user'
      }
    }, {
      name: 'UserCreate',
      path: '/user/create',
      component: '/user/edit',
      meta: {
        title: '添加',
        roles: ['admin'],
        activeMenu: '/user'
      },
      hidden: true
    }, {
      name: 'UserEdit',
      path: '/user/:id(\\d+)/edit',
      component: '/user/edit',
      hidden: true,
      meta: {
        title: '编辑',
        roles: ['admin'],
        activeMenu: '/user'
      }
    }]
  }, {
    path: '/role',
    name: 'Role',
    component: '/empty',
    alwaysShow: false,
    redirect: '/role/index',
    meta: {
      title: '角色管理',
      icon: 'awesome-icon far fa-address-card',
      roles: ['admin']
    },
    children: [{
      name: 'RoleIndex',
      path: '/role/index',
      component: '/role/index',
      hidden: true,
      meta: {
        title: '列表',
        roles: ['admin'],
        activeMenu: '/role'
      }
    }, {
      name: 'RoleCreate',
      path: '/role/create',
      component: '/role/edit',
      hidden: true,
      meta: {
        title: '添加',
        roles: ['admin'],
        activeMenu: '/role'
      }
    }, {
      name: 'RoleEdit',
      path: '/role/:id(\\d+)/edit',
      component: '/role/edit',
      hidden: true,
      meta: {
        title: '编辑',
        roles: ['admin'],
        activeMenu: '/role'
      }
    }]
  }, {
    name: 'Menu',
    path: '/menu',
    component: '/empty',
    alwaysShow: false,
    redirect: '/menu/index',
    meta: {
      title: '权限菜单',
      icon: 'tree-table',
      roles: ['admin']
    },
    children: [{
      name: 'MenuIndex',
      path: '/menu/index',
      component: '/menu/index',
      hidden: true,
      meta: {
        title: '列表',
        roles: ['admin'],
        activeMenu: '/menu'
      }
    }, {
      name: 'MenuCreate',
      path: '/menu/create',
      component: '/menu/edit',
      hidden: true,
      meta: {
        title: '添加',
        roles: ['admin'],
        activeMenu: '/menu'
      }
    }, {
      name: 'MenuEdit',
      path: '/menu/:id(\\d+)/edit',
      component: '/menu/edit',
      hidden: true,
      meta: {
        title: '编辑',
        roles: ['admin'],
        activeMenu: '/menu'
      }
    }]
  }, {
    path: '/navigation',
    name: 'Navigation',
    component: '/empty',
    meta: {
      title: '导航管理',
      icon: 'el-icon-s-promotion',
      roles: ['admin']
    },
    alwaysShow: false,
    redirect: '/navigation/index',
    children: [{
      name: 'NavigationIndex',
      path: '/navigation/index',
      component: '/navigation/index',
      hidden: true,
      meta: {
        title: '列表',
        roles: ['admin'],
        activeMenu: '/navigation'
      }
    }, {
      name: 'NavigationCreate',
      path: '/navigation/create',
      component: '/navigation/edit',
      hidden: true,
      meta: {
        title: '添加',
        roles: ['admin'],
        activeMenu: '/navigation'
      }
    }, {
      name: 'NavigationEdit',
      path: '/navigation/:id(\\d+)/edit',
      component: '/navigation/edit',
      hidden: true,
      meta: {
        title: '编辑',
        roles: ['admin'],
        activeMenu: '/navigation'
      }
    }]
  }, {
    name: 'Dictionary',
    path: '/dictionary',
    component: '/empty',
    meta: {
      title: '数据字典',
      icon: 'el-icon-notebook-2',
      roles: ['admin']
    },
    alwaysShow: false,
    redirect: '/dictionary/index',
    children: [{
      name: 'DictionaryIndex',
      path: '/dictionary/index',
      component: '/dictionary/index',
      hidden: true,
      meta: {
        title: '列表',
        roles: ['admin'],
        activeMenu: '/dictionary'
      }
    },
    {
      name: 'DictionaryCreate',
      path: '/dictionary/create',
      component: '/dictionary/edit',
      hidden: true,
      meta: {
        title: '添加',
        roles: ['admin'],
        activeMenu: '/dictionary'
      }
    },
    {
      name: 'DictionaryEdit',
      path: '/dictionary/:id(\\d+)/edit',
      component: '/dictionary/edit',
      hidden: true,
      meta: {
        title: '编辑',
        roles: ['admin'],
        activeMenu: '/dictionary'
      }
    }
    ]
  },
  {
    name: 'DictionaryItems',
    path: '/dictionary-items',
    component: '/empty',
    hidden: true,
    redirect: 'noRedirect',
    meta: {
      title: '变量选项',
      roles: ['admin'],
      activeMenu: '/dictionary'
    },
    children: [{
      name: 'DictionaryItemsIndex',
      path: '/dictionary/:did(\\d+)/dictionary-items/index',
      component: '/dictionary-items/index',
      hidden: true,
      meta: {
        title: '列表',
        roles: ['admin'],
        activeMenu: '/dictionary'
      }
    },
    {
      name: 'DictionaryItemsCreate',
      path: '/dictionary/:did(\\d+)/dictionary-items/create',
      component: '/dictionary-items/edit',
      hidden: true,
      meta: {
        title: '添加',
        roles: ['admin'],
        activeMenu: '/dictionary'
      }
    },
    {
      name: 'DictionaryItemsEdit',
      path: '/dictionary/:did(\\d+)/dictionary-items/:id(\\d+)/edit',
      component: '/dictionary-items/edit',
      hidden: true,
      meta: {
        title: '编辑',
        roles: ['admin'],
        activeMenu: '/dictionary'
      }
    }
    ]
  }, {
    name: 'AdminLog',
    path: '/admin-log',
    component: '/admin-log/index',
    meta: {
      title: '操作日志',
      icon: 'awesome-icon fas fa-history',
      roles: ['admin']
    }
  }
  ]
},
{
  name: 'profile',
  path: '/profile',
  component: '/layout',
  redirect: '/profile/edit',
  hidden: true,
  meta: {
    roles: ['admin']
  },
  children: [{
    name: 'ProfileEdit',
    path: '/profile/edit',
    component: '/profile/edit',
    meta: {
      title: '编辑个人资料',
      icon: 'user',
      noCache: true,
      roles: ['admin']
    }
  }]
},
{
  path: 'external-link',
  component: '/layout',
  children: [{
    path: 'https://jishupu.com',
    meta: {
      title: '外部链接',
      icon: 'link',
      roles: ['admin']
    }
  }]
},
{
  name: 'DevTools',
  path: '/dev-tool',
  component: '/layout',
  redirect: 'noRedirect',
  alwaysShow: true,
  meta: {
    title: '开发工具',
    icon: 'awesome-icon fas fa-laptop-code',
    roles: ['admin']
  },
  children: [{
    name: 'CodeMaker',
    path: '/code-maker',
    component: '/code-maker/edit',
    meta: {
      title: '代码生成器',
      icon: 'awesome-icon far fa-copy',
      roles: ['admin'],
      breadcrumb: true
    }
  }]
}
]

module.exports = [
  // 菜单管理数据
  {
    url: '/menu/list',
    type: 'get',
    response: _ => {
      return {
        code: 20000,
        data: {
          items: menu,
          total: menu.length
        }
      }
    }
  },
  // 用户菜单
  {
    url: '/menu/getUserMenu',
    type: 'get',
    response: _ => {
      return {
        code: 20000,
        data: {
          items: userMenu,
          total: userMenu.length
        }
      }
    }
  }
]
